<?php Yii::app()->clientScript->registerScriptFile(Yii::app()->params['static'].'assets/js/bootbox.min.js',2); ?>
<div class="row">
<div class="col-xs-12">
<div class="row">
<div class="col-xs-12">
										<div class="widget-box">
											<div class="widget-header widget-header-small">
												<h5 class="lighter">查询</h5>
											</div>

											<div class="widget-body">
												<div class="widget-main">
													<?php  $this->renderPartial("_searchform",array('classRooms'=>$classRooms,'major'=>$major)); ?>
												</div>
											</div>
										</div>
										
</div>
</div>
<div class="hr hr-18 dotted hr-double"></div>
<div class="row">

		<div class="col-xs-12">
		    <div class="widget-box">
											<div class="widget-header widget-header-small">
												<h5>共检索出：<?php echo $total; ?> 条数据</h5>
											</div>

											<div class="widget-body">
												<div class="widget-main">
											<div class="table-responsive">
										<div class="table-responsive">
											<table id="sample-table-1" class="table table-striped table-bordered table-hover">
												<thead>
													<tr>
													
													   <th>姓名</th>
														<th>手机号</th>
														<th>家庭住址</th>
														<th>
														定向区县
														</th>
														<th>
														家长电话
														</th>
														<th>
														身份证
														</th>
														<th>
														银行卡号
														</th>
														<th>
													    银行
														</th>
														
														<th>
														<i class="icon-wrench bigger-110 hidden-480"></i>
														操作
														</th>
													</tr>
												</thead>

												<tbody>
												<?php
											    foreach($stus as $s){
													$extraData = '班级：'.$s->classRoom.'<br>年级：'.$s->grade.'<br>专业：'.$s->major.'<br>学号：'.$s->user->username;
												echo'	
												<tr data-rel="tooltip" data-original-title="'.$extraData.'">
												
												<td>'.$s->realName.'</td>
												<td>'.$s->phoneNum.'</td>
												<td>'.$s->homePlace.'</td>
												<td>'.$s->directionalDistrict.'</td>
												<td>'.$s->parentNum.'</td>
												<td>'.$s->idNum.'</td>
												<td>'.$s->bankNum.'</td>
												<td>'.$s->bankName.'</td>
												
												<td>
												
												<a href="'.Yii::app()->CreateUrl('basicinfo/editstuinfo',array('uId'=>$s->uId)).'" target="_blank">
												<button class="btn btn-xs btn-info" data-rel="tooltip" data-original-title="修改">
												   <i class="icon-edit bigger-100"></i>
												</button>
												</a>
                                              										
												</td>
											    </tr>';
												
												}
                                               ?>												
											    </tbody>
											
											</table>
									       
											
							<p>
							<form id="export-form" method="get" action="<?php echo Yii::app()->createUrl('basicinfo/export');?>" target="_blank">
								<?php
								   $request = Yii::app()->request;
								   echo '<input type="hidden" value="'.$request->getParam('grade').'" name="grade">';
								   echo '<input type="hidden" value="'.$request->getParam('major').'" name="major">';
								   echo '<input type="hidden" value="'.$request->getParam('classRoom').'" name="classRoom">';
								   echo '<input type="hidden" value="'.$request->getParam('stuNum').'" name="stuNum">';
								?>
								 <button class="btn btn-lg btn-info">
									<i class="icon-share-alt bigger-100" type="button" id="export-button"></i>
										导出为 EXCEL										
								  </button>
							 </form>
							</p>
							 <div class="col-xs-12" style="text-align:center">
										     <?php 
											 $this->widget('CLinkPager',array( 
													'htmlOptions'=>array('class'=>'pagination'),
													'cssFile'=>false,
													'header'=>'',    
													'firstPageLabel' => '首页',    
													'lastPageLabel' => '末页',    
													'prevPageLabel' => '上一页',    
													'nextPageLabel' => '下一页',    
													'pages' => $pages,    
													'maxButtonCount'=>13    
												)    
											);    
												
										?>
									</div>
							</div><!-- /.table-responsive -->
		</div>
     </div>
										
</div>
</div>
</div>
<script type="text/javascript">

			jQuery(function($) {
				$('table th input:checkbox').on('click' , function(){
					var that = this;
					$(this).closest('table').find('tr > td:first-child input:checkbox')
					.each(function(){
						this.checked = that.checked;
						$(this).closest('tr').toggleClass('selected');
					});
						
				});
			  
			  $('#export-button').on('click',function(){
				    
				bootbox.confirm('导出的数据是通过审核的数据，可能会花费较长的时间。确定要导出吗？',function(result){
					 if(result){
						 
						 $('#export-form').submit();
						 
					 }
					
				});					
				  
			  });
			
				
			})
		
</script>